{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "-1"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import cv2\n",
    "import numpy as np\n",
    "img = cv2.imread('image0.jpg',1)\n",
    "# 字体\n",
    "font = cv2.FONT_HERSHEY_SIMPLEX \n",
    "# 画出矩形框\n",
    "cv2.rectangle(img,(200,100),(500,400),(0,255,0),3)\n",
    "# 绘制文字\n",
    "# 参数2：文字内容 参数3：写入坐标 参数4：字体 参数5：字体大小 参数7：字体粗细 参数8：线条类型\n",
    "cv2.putText(img,'MengMeng is more beautiful than this flower',(0,300),font,0.8,(200,100,255),2,cv2.LINE_AA)\n",
    "cv2.imshow('img',img)\n",
    "cv2.waitKey(0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "-1"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 绘制图片\n",
    "img = cv2.imread('image0.jpg',1)\n",
    "height = int(img.shape[0]*0.2)\n",
    "width = int(img.shape[1]*0.2)\n",
    "imgResize = cv2.resize(img,(width,height))\n",
    "for i in range(0,height):\n",
    "    for j in range(0,width):\n",
    "        img[i+200,j+350] = imgResize[i,j]\n",
    "cv2.imshow('img',img)\n",
    "cv2.waitKey(0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
